package first.endtoend.models;

import java.io.Serializable;
import java.util.ArrayList;

import com.api.sqlitehelper.ClassPersistable;
import com.api.sqlitehelper.FieldPersistable;
import com.api.sqlitehelper.FieldPersistable.Type;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

@ClassPersistable
public class Portfolio implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Expose
	@SerializedName("id")
	@FieldPersistable(value=Type.PRIMARY_KEY)
	private int portfolioId;
	
	@Expose(serialize=false)
	private ArrayList<PortfolioDetail> details;	
	//List of product to up to date on the server
	@Expose(deserialize=false)
	@SerializedName("details")
	private ArrayList<PortfolioDetail> productsSelected;
	
	@FieldPersistable(value=Type.FOREIGN_KEY)
	private Family family;
	
	private int version;

	public Portfolio(int portfolioId, Family family, int version) {
		this.portfolioId = portfolioId;
		this.family = family;
		this.version= version; 
	}

	public Portfolio() {
	}

	/**
	 * @return the portfolioId
	 */
	public int getPortfolioId() {
		return portfolioId;
	}
	/**
	 * @param portfolioId the portfolioId to set
	 */
	public void setPortfolioId(int portfolioId) {
		this.portfolioId = portfolioId;
	}

	/**
	 * @return the details
	 */
	public ArrayList<PortfolioDetail> getDetails() {
		return details;
	}

	/**
	 * @param details the details to set
	 */
	public void setDetails(ArrayList<PortfolioDetail> details) {
		this.details = details;
	}

	/**
	 * @return the productsSelected
	 */
	public ArrayList<PortfolioDetail> getProductsSelected() {
		return productsSelected;
	}

	/**
	 * @param productsSelected the productsSelected to set
	 */
	public void setProductsSelected(ArrayList<PortfolioDetail> productsSelected) {
		this.productsSelected = productsSelected;
	}


	/**
	 * @return the family
	 */
	public Family getFamily() {
		return family;
	}

	/**
	 * @param family the family to set
	 */
	public void setFamily(Family family) {
		this.family = family;
	}
	
	/**
	 * @return the version number to compare with the server 
	 * */
	public int getVersion(){
		return version;
	}
	
	/**
	 * @param the version to set after a transaction 
	 * */
	public void setVersion(int version){
		this.version= version;
	}
	
}
